home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / pcxpas.com / SHOW256.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-10-15  |  1.6 KB  |  52 lines

  1. program SHOW256;
  2.  
  3. (* Sample implementation of PCX256.TPU. Enter a filename (without extension)
  4.    on the command line or, if running under Turbo, in the Parameters box.
  5.  
  6.    Since the BGI doesn't seem to support the 256-color mode, we go it
  7.    alone with BIOS calls. *)
  8.  
  9. uses DOS, CRT, PCX256;
  10.  
  11. var   regs: registers;
  12.       blackpal: array[0..255] of RGBrec;
  13.  
  14. procedure SETMODE(mode: byte);
  15.  
  16. begin
  17. regs.ah:= 0;                 { BIOS set mode function }
  18. regs.al:= mode;              { Display mode }
  19. intr($10, regs);             { Call BIOS }
  20. end;
  21.  
  22. procedure SETREGISTERS(var palrec);
  23.  
  24. begin
  25. regs.ah:= $10;               { BIOS color register function }
  26. regs.al:= $12;               { Subfunction }
  27. regs.es:= seg(palrec);       { Address of palette info. }
  28. regs.dx:= ofs(palrec);
  29. regs.bx:= 0;                 { First register to change }
  30. regs.cx:= $FF;               { Number of registers to change }
  31. intr($10, regs);             { Call BIOS }
  32. end;
  33.  
  34. (* -------------------------- SHOW256 --------------------------------- *)
  35.  
  36. begin
  37. pcxfilename:= paramstr(1) + '.PCX';
  38. setmode($13);                            { Set 320 x 200 x 256 mode }
  39. fillchar(blackpal, 768, 0);              { Set all color registers to black }
  40. setregisters(blackpal);
  41. read_pcx256(pcxfilename);                { Put image into display memory }
  42. if file_error then
  43. begin
  44.   setmode(3);
  45.   writeln('Can''t read that file.');
  46.   halt;
  47. end;
  48. setregisters(RGBpal);                    { Show true colors }
  49. repeat until readkey <> #1;
  50. setmode(3);                              { Restore text mode }
  51. end.
  52.